package net.zrnecko.bowlingnumbers.session;

import net.zrnecko.bowlingnumbers.entity.*;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.framework.EntityQuery;
import java.util.List;
import java.util.Arrays;

@Name("playerList")
public class PlayerList extends EntityQuery {

	private static final String[] RESTRICTIONS = {"lower(player.name) like concat(lower(#{playerList.player.name}),'%')",};

	private Player player = new Player();

	@Override
	public String getEjbql() {
		return "select player from Player player";
	}

	@Override
	public Integer getMaxResults() {
		return 25;
	}

	public Player getPlayer() {
		return player;
	}

	@Override
	public List<String> getRestrictions() {
		return Arrays.asList(RESTRICTIONS);
	}

}
